<template>
  <div class="elm-edit f_edit">
    <elm-page-bb class="ei_edit" v-loading="loading">
      <el-row></el-row>
      <el-card shadow="hover" style="margin-top: 10px;height: 100px;">
        <div slot="header">
          <span style="font-weight: bold;">连线指向</span>
        </div>
        <el-row style="height: 10px;"></el-row>
        <div style="float: left;margin-top: 5px;margin-left: 10px;">指向节点：</div>
        <el-select v-model="end_node" size="mini" style="width:180px;">
          <el-option
              v-for="item in node_for_select_list"
              :key="item.id"
              :label="item.title"
              :value="item.id">
          </el-option>
        </el-select>
      </el-card>

      <template #bottom>
        <el-button type="success" size="small" @click="submit">确定</el-button>
        <el-button size="small" @click="close">取消</el-button>
      </template>
    </elm-page-bb>
  </div>
</template>

<script>
export default {
  extends: elmVueBase,
  data() {
    return {
      loading:true,

      DE_INFO: null,
      start_node:'',
      end_node:'',
      node_for_select_list:[],
    }
  },
  mounted() {
    this.DE_INFO = elm.dialog.request;
    this.start_node = this.DE_INFO.node_id;
    this.node_for_select_list = this.DE_INFO.node_for_select_list;

    this.v_getData();
  },
  methods: {
    async v_getData(){
      this.loading = true;
      this.loading = false;
    },

    submit:function (){
      let lineItem = {
        'id':elm.newGuid(),
        'start_node':this.start_node,
        'end_node':this.end_node,
        'type':'default',
        'allow_change_to_node':true,
        'allow_delete':true,
        'condition_s':'',
        'condition_s_str':'',
      };
      this.DE_INFO.callVue.refreshNodeLine({'add_line_list':[lineItem]});
      this.v_cancle();
    },
    v_cancle(){
      this.close();//extends: elmVueBase
    },


    em(s) {
      if (s == null || s == '') { return true; }
      else { return false; }
    },

  }
}
</script>
<style>
.f_edit .elm-body{ padding: 5px; }
</style>